package net.telesing.tcmc.back.modelqp;

import net.telesing.tcmc.common.QueryParam;
import net.telesing.tcmc.core.StringUtil;
import org.nutz.dao.Cnd;
import org.nutz.lang.Strings;

/**
 * Created by bys on 2015/11/3.
 */
public class SectionQp extends QueryParam
{
    private String name;
    private String orgCode;
    private String orgName;
    private long orgId;
    @Override
    public Cnd buildWhere()
    {
        Cnd cnd = super.buildWhere();
        if(!Strings.isEmpty(name))
            cnd = cnd.and("NAME", "like", StringUtil.transferLike(name));
        if(!Strings.isEmpty(orgCode))
            cnd = cnd.and("ORG_CODE", "like", StringUtil.transferLike(orgCode));
        if(!Strings.isEmpty(orgName))
            cnd = cnd.and("ORG_NAME", "like", StringUtil.transferLike(orgName));
        if(orgId != 0)
            cnd = cnd.and("OID", "=", orgId);
        cnd.desc("ID");
        return cnd;
    }

    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public String getOrgCode()
    {
        return orgCode;
    }

    public void setOrgCode(String orgCode)
    {
        this.orgCode = orgCode;
    }

    public String getOrgName()
    {
        return orgName;
    }

    public void setOrgName(String orgName)
    {
        this.orgName = orgName;
    }

    public long getOrgId()
    {
        return orgId;
    }

    public void setOrgId(long orgId)
    {
        this.orgId = orgId;
    }
}
